﻿Imports System.Data.SqlClient
Public Class FrmCungcapKiemke
    Dim tbl As DataTable
    Dim dbAdapter As SqlDataAdapter
    Dim cmd As SqlCommand
    Dim tennhap As String
    Private Sub NapPhong()
        cmd = New SqlCommand(" select * from DMPhong", ob_cnn)
        dbAdapter = New SqlDataAdapter(cmd)
        tbl = New DataTable()
        dbAdapter.Fill(tbl)
        ComboBoxPhong.DisplayMember = "Tenphong"
        ComboBoxPhong.ValueMember = "maPhongID"
        ComboBoxPhong.DataSource = tbl
        ob_cnn.Close()
    End Sub
    Private Sub NapNgan()
        cmd = New SqlCommand(" select * from DMNgan", ob_cnn)
        dbAdapter = New SqlDataAdapter(cmd)
        tbl = New DataTable()
        dbAdapter.Fill(tbl)
        ComboBoxNgan.DisplayMember = "TenNgan"
        ComboBoxNgan.ValueMember = "maNganID"
        ComboBoxNgan.DataSource = tbl
        ob_cnn.Close()
    End Sub
    Private Sub NapKe()
        cmd = New SqlCommand(" select * from DMKe", ob_cnn)
        dbAdapter = New SqlDataAdapter(cmd)
        tbl = New DataTable()
        dbAdapter.Fill(tbl)
        ComboBoxKe.DisplayMember = "TenKe"
        ComboBoxKe.ValueMember = "maKeID"
        ComboBoxKe.DataSource = tbl
        ob_cnn.Close()
    End Sub
    Private Sub NapKho()
        cmd = New SqlCommand(" select * from DMKho", ob_cnn)
        dbAdapter = New SqlDataAdapter(cmd)
        tbl = New DataTable()
        dbAdapter.Fill(tbl)
        ComboBoxKho.DisplayMember = "TenKho"
        ComboBoxKho.ValueMember = "maKhoID"
        ComboBoxKho.DataSource = tbl
        ob_cnn.Close()
    End Sub
    Private Sub Naphoso()
        cmd = New SqlCommand(" select * from DMHosokiemke", ob_cnn)
        dbAdapter = New SqlDataAdapter(cmd)
        tbl = New DataTable()
        dbAdapter.Fill(tbl)
        ComboBoxHoso.DisplayMember = "Tenloaihoso"
        ComboBoxHoso.ValueMember = "MaloaiID"
        ComboBoxHoso.DataSource = tbl
        ob_cnn.Close()
    End Sub
    Private Sub NapTaiLieuKK()
        cmd = New SqlCommand(" select * from DMTaiLieuKK", ob_cnn)
        dbAdapter = New SqlDataAdapter(cmd)
        tbl = New DataTable()
        dbAdapter.Fill(tbl)
        ComboBoxTaiLieuKK.DisplayMember = "TenTaiLieuKK"
        ComboBoxTaiLieuKK.ValueMember = "MaTaiLieuKK"
        ComboBoxTaiLieuKK.DataSource = tbl
        ob_cnn.Close()
    End Sub
    Private Sub NapDonViHuyen()
        cmd = New SqlCommand(" select * from TENHUYEN", ob_cnn)
        dbAdapter = New SqlDataAdapter(cmd)
        tbl = New DataTable()
        dbAdapter.Fill(tbl)
        ComboBoxHuyen.DisplayMember = "T_huyen"
        ComboBoxHuyen.ValueMember = "maH"
        ComboBoxHuyen.DataSource = tbl
        ob_cnn.Close()
    End Sub
    Private Sub NapHinhThuc()
        cmd = New SqlCommand(" select * from DMHinhThuc", ob_cnn)
        dbAdapter = New SqlDataAdapter(cmd)
        tbl = New DataTable()
        dbAdapter.Fill(tbl)
        ComboBoxHinhThuc.DisplayMember = "TenHinhThuc"
        ComboBoxHinhThuc.ValueMember = "maHinhThucID"
        ComboBoxHinhThuc.DataSource = tbl
        ob_cnn.Close()
    End Sub
    Private Sub NapThoiHanBaoQuan()
        cmd = New SqlCommand(" select * from DMThoiHanBaoQuan", ob_cnn)
        dbAdapter = New SqlDataAdapter(cmd)
        tbl = New DataTable()
        dbAdapter.Fill(tbl)
        ComboBoxThoiHanBQ.DisplayMember = "ThoiHanBaoQuan"
        ComboBoxThoiHanBQ.ValueMember = "MaDMThoiHan"
        ComboBoxThoiHanBQ.DataSource = tbl
        ob_cnn.Close()
    End Sub
    Private Sub FrmNhapKiemke_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        NapKho()
        NapKe()
        NapNgan()
        NapPhong()
        Naphoso()
        NapTaiLieuKK()
        NapDonViHuyen()
        NapHinhThuc()
        NapThoiHanBaoQuan()
        ButtonInPhieu.Enabled = False
    End Sub
    Private Sub Lamtuoi()
        TextBoxNamLap.Text = ""
        TextBoxNguoiYeuCau.Text = ""
        ButtonInPhieu.Enabled = False
    End Sub
    Private Sub TimKiemTheoThongKeKiemKeCapTinh()
        ob_cnn.Open()
        cmd = New SqlCommand("SELECT hskk.NgayNhapKho, hskk.NamThucHien, dmtlkk.TenTaiLieuKK, dmhskk.Tenloaihoso, dvhc.TenCapDVHC, thbq.ThoiHanBaoQuan, kho.TenKho, ke.TenKe, ngan.TenNgan, phong.TenPhong, tinhtrang.TenTinhTrang, huyen.T_Huyen, xa.TenXa, hskk.MahosoID " &
                                "FROM HOSOKIEMKE hskk, DMTailieuKK dmtlkk, DMHosokiemke dmhskk, CAPDONVIHANHCHINH dvhc, DMThoiHanBaoQuan thbq, TENXA xa, TENHUYEN huyen, DMKho kho, DMKe ke, DMNgan ngan, DMPhong phong, DMTinhTrang tinhtrang " &
                                "WHERE hskk.CapDVHCID = dvhc.CapDVHCID and hskk.MaLoaiHSID = dmtlkk.MaTaiLieuKK AND hskk.TenQuyen = dmhskk.MaloaiID AND hskk.MaTinhTrangId = tinhtrang.MaTinhTrangID AND  hskk.MaDMThoiHanID = thbq.MaDMThoiHan And hskk.MaxaId = xa.MaXa And hskk.MaHuyenID = huyen.maH And hskk.MaKhoId = kho.maKhoID And hskk.MaKeId = ke.MaKeID AND hskk.MaPhongId = phong.MaPhongID and hskk.MaNganId = ngan.MaNganID " &
                                "AND hskk.MaTinhTrangId = 1 " &
                                "AND hskk.TenQuyen = '" & ComboBoxHoso.SelectedValue & "' " &
                                "AND hskk.MaLoaiHSID = '" & ComboBoxTaiLieuKK.SelectedValue & "' " &
                                "AND hskk.CapDVHCID = 1" &
                                "AND hskk.NamThucHien LIKE '%" & TextBoxNamLap.Text & "%'", ob_cnn)
        tbl = New DataTable()
        tbl.Load(cmd.ExecuteReader())
        DataGridView_hienthi.DataSource = tbl
        If tbl.Rows.Count = 0 Then
            MessageBox.Show("Không tìm thấy thông tin ! ")
        End If
        ob_cnn.Close()
    End Sub
    Private Sub TimKiemTheoThongKeKiemKeCapHuyen()
        ob_cnn.Open()
        cmd = New SqlCommand("SELECT hskk.NgayNhapKho, hskk.NamThucHien, dmtlkk.TenTaiLieuKK, dmhskk.Tenloaihoso, dvhc.TenCapDVHC, thbq.ThoiHanBaoQuan, kho.TenKho, ke.TenKe, ngan.TenNgan, phong.TenPhong, tinhtrang.TenTinhTrang, huyen.T_Huyen, xa.TenXa, hskk.MahosoID " &
                                "FROM HOSOKIEMKE hskk, DMTailieuKK dmtlkk, DMHosokiemke dmhskk, CAPDONVIHANHCHINH dvhc, DMThoiHanBaoQuan thbq, TENXA xa, TENHUYEN huyen, DMKho kho, DMKe ke, DMNgan ngan, DMPhong phong, DMTinhTrang tinhtrang " &
                                "WHERE hskk.CapDVHCID = dvhc.CapDVHCID and hskk.MaLoaiHSID = dmtlkk.MaTaiLieuKK AND hskk.TenQuyen = dmhskk.MaloaiID AND hskk.MaTinhTrangId = tinhtrang.MaTinhTrangID AND hskk.MaDMThoiHanID = thbq.MaDMThoiHan And hskk.MaxaId = xa.MaXa And hskk.MaHuyenID = huyen.maH And hskk.MaKhoId = kho.maKhoID And hskk.MaKeId = ke.MaKeID AND hskk.MaPhongId = phong.MaPhongID and hskk.MaNganId = ngan.MaNganID " &
                                "AND hskk.MaTinhTrangId = 1 " &
                                "AND hskk.TenQuyen = '" & ComboBoxHoso.SelectedValue & "' " &
                                "AND hskk.MaLoaiHSID = '" & ComboBoxTaiLieuKK.SelectedValue & "' " &
                                "AND hskk.CapDVHCID = 2" &
                                "AND hskk.NamThucHien LIKE '%" & TextBoxNamLap.Text & "%'", ob_cnn)
        '"AND hskk.NgayNhapKho >= '" & dtpTuNgay.Text & "' " &
        '"AND hskk.NgayNhapKho <= '" & dtpDenNgay.Text & "' "
        tbl = New DataTable()
        tbl.Load(cmd.ExecuteReader())
        DataGridView_hienthi.DataSource = tbl
        If tbl.Rows.Count = 0 Then
            MessageBox.Show("Không tìm thấy thông tin ! ")
        End If
        ob_cnn.Close()
    End Sub
    Private Sub TimKiemTheoThongKeKiemKeCapXa()
        ob_cnn.Open()
        cmd = New SqlCommand("SELECT hskk.NgayNhapKho, hskk.NamThucHien, dmtlkk.TenTaiLieuKK, dmhskk.Tenloaihoso, dvhc.TenCapDVHC, thbq.ThoiHanBaoQuan, kho.TenKho, ke.TenKe, ngan.TenNgan, phong.TenPhong, tinhtrang.TenTinhTrang, huyen.T_Huyen, xa.TenXa, hskk.MahosoID " &
                                "FROM HOSOKIEMKE hskk, DMTailieuKK dmtlkk, DMHosokiemke dmhskk, CAPDONVIHANHCHINH dvhc, DMThoiHanBaoQuan thbq, TENXA xa, TENHUYEN huyen, DMKho kho, DMKe ke, DMNgan ngan, DMPhong phong, DMTinhTrang tinhtrang " &
                                "WHERE hskk.CapDVHCID = dvhc.CapDVHCID and hskk.MaLoaiHSID = dmtlkk.MaTaiLieuKK AND hskk.TenQuyen = dmhskk.MaloaiID AND hskk.MaTinhTrangId = tinhtrang.MaTinhTrangID AND hskk.MaDMThoiHanID = thbq.MaDMThoiHan And hskk.MaxaId = xa.MaXa And hskk.MaHuyenID = huyen.maH And hskk.MaKhoId = kho.maKhoID And hskk.MaKeId = ke.MaKeID AND hskk.MaPhongId = phong.MaPhongID and hskk.MaNganId = ngan.MaNganID " &
                                "AND hskk.MaTinhTrangId = 1 " &
                                "AND hskk.TenQuyen = '" & ComboBoxHoso.SelectedValue & "' " &
                                "AND hskk.MaLoaiHSID = '" & ComboBoxTaiLieuKK.SelectedValue & "' " &
                                "AND hskk.CapDVHCID = 3" &
                                "AND hskk.NamThucHien LIKE '%" & TextBoxNamLap.Text & "%'", ob_cnn)
        tbl = New DataTable()
        tbl.Load(cmd.ExecuteReader())
        DataGridView_hienthi.DataSource = tbl
        If tbl.Rows.Count = 0 Then
            MessageBox.Show("Không tìm thấy thông tin ! ")
        End If
        ob_cnn.Close()
    End Sub

    Private Sub ButtonTìmkiem_Click(sender As Object, e As EventArgs) Handles ButtonTìmkiem.Click
        If rbTinh.Checked Then
            TimKiemTheoThongKeKiemKeCapTinh()
            LoadNguoiMuon()
            TextBoxNamLap.Text = ""
        End If
        If rbHuyen.Checked Then
            TimKiemTheoThongKeKiemKeCapHuyen()
            LoadNguoiMuon()
            TextBoxNamLap.Text = ""
        End If
        If rbXa.Checked Then
            TimKiemTheoThongKeKiemKeCapXa()
            LoadNguoiMuon()
            TextBoxNamLap.Text = ""
        End If
        ButtonInPhieu.Enabled = False
        ButtonCapnhat.Enabled = True
    End Sub
    Private Sub LoadNguoiMuon()
        ob_cnn.Open()
        cmd = New SqlCommand("SELECT DISTINCT(NguoiMuon), DonVi, DiaChi FROM CCTT_HOSOKIEMKE_THONGKE", ob_cnn)
        tbl = New DataTable()
        tbl.Load(cmd.ExecuteReader())
        DataGridViewNguoiMuon.DataSource = tbl
        ob_cnn.Close()
    End Sub
    Private Sub ThemDuLieu()
        Try
            Dim NgayMuon As String
            NgayMuon = String.Format("{0:MM/dd/yyyy}", DateTimePicker2.Value)
            Dim Sql As String = ""
            Sql = " insert into CCTT_HOSOKIEMKE_THONGKE(SoHoSo, NgayMuon, NguoiMuon, DonVi, DiaChi, HinhThucMuonId, MucDichMuon, xaID, HuyenID, Tinhtrangid)" &
                " values(@sohoso, @ngaymuon, @nguoimuon, @donvi, @diachi, @hinhthucmuon, @mucdichmuon, @xa, @huyen, @tinhtrangid)"
            cmd = New SqlCommand(Sql, ob_cnn)
            cmd.Parameters.AddWithValue("@sohoso", TextBoxSoHoSo.Text)
            cmd.Parameters.AddWithValue("@ngaymuon", NgayMuon)
            cmd.Parameters.AddWithValue("@nguoimuon", TextBoxNguoiYeuCau.Text)
            cmd.Parameters.AddWithValue("@donvi", TextBoxDonViCT.Text)
            cmd.Parameters.AddWithValue("@diachi", TextBoxDiaChi.Text)
            cmd.Parameters.AddWithValue("@hinhthucmuon", ComboBoxHinhThuc.SelectedValue)
            cmd.Parameters.AddWithValue("@mucdichmuon", TextBoxMucDichSuDung.Text)
            cmd.Parameters.AddWithValue("@xa", ComboBoxXa.SelectedValue)
            cmd.Parameters.AddWithValue("@huyen", ComboBoxHuyen.SelectedValue)
            cmd.Parameters.AddWithValue("@tinhtrangid", 2)
            ob_cnn.Open()
            cmd.ExecuteNonQuery()
            ob_cnn.Close()
            SuaTinhTrangHoSo()
            MsgBox("Thao tác thành công!")
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
    End Sub
    Private Sub SuaTinhTrangHoSo()
        Try
            Dim sqlString As String = ""
            sqlString = "UPDATE HOSOKIEMKE SET MaTinhTrangId = @matinhtrangid " &
                  "WHERE MahosoID = @sohoso"
            cmd = New SqlCommand(sqlString, ob_cnn)
            cmd.Parameters.AddWithValue("@matinhtrangid", 2)
            cmd.Parameters.AddWithValue("@sohoso", TextBoxSoHoSo.Text)
            ob_cnn.Open()
            cmd.ExecuteNonQuery()
            ob_cnn.Close()
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
    End Sub
    Private Sub ButtonCapnhat_Click(sender As Object, e As EventArgs) Handles ButtonCapnhat.Click
        If TextBoxNguoiYeuCau.Text = "" Then
            MessageBox.Show("Vui lòng nhập vào tên người mượn !")
            Return
        End If
        If TextBoxDonViCT.Text = "" Then
            MessageBox.Show("Vui lòng nhập vào đơn vị công tác !")
            Return
        End If
        If TextBoxMucDichSuDung.Text = "" Then
            MessageBox.Show("Vui lòng nhập vào mục đích sử dụng !")
            Return
        End If
        If TextBoxSoHoSo.Text = Nothing Then
            MessageBox.Show("Vui lòng chọn hồ sơ cho mượn !")
            Return
        End If
        ThemDuLieu()
        If rbTinh.Checked Then
            TimKiemTheoThongKeKiemKeCapTinh()
            LoadNguoiMuon()
        End If
        If rbHuyen.Checked Then
            TimKiemTheoThongKeKiemKeCapHuyen()
            LoadNguoiMuon()
        End If
        If rbXa.Checked Then
            TimKiemTheoThongKeKiemKeCapXa()
            LoadNguoiMuon()
        End If
        ButtonInPhieu.Enabled = True
        ButtonCapnhat.Enabled = False
    End Sub

    Private Sub NapVaoTexBox()
        ComboBoxHoso.DataBindings.Clear()
        ComboBoxHoso.DataBindings.Add("Text", DataGridView_hienthi.DataSource, "Tenloaihoso")
        TextBoxNamLap.DataBindings.Clear()
        TextBoxNamLap.DataBindings.Add("Text", DataGridView_hienthi.DataSource, "NamThucHien")
        TextBoxSoHoSo.DataBindings.Clear()
        TextBoxSoHoSo.DataBindings.Add("Text", DataGridView_hienthi.DataSource, "MahosoID")
        DateTimePicker1.DataBindings.Clear()
        DateTimePicker1.DataBindings.Add("Text", DataGridView_hienthi.DataSource, "NgayNhapKho")
        ComboBoxPhong.DataBindings.Clear()
        ComboBoxPhong.DataBindings.Add("Text", DataGridView_hienthi.DataSource, "TenPhong")
        ComboBoxNgan.DataBindings.Clear()
        ComboBoxNgan.DataBindings.Add("Text", DataGridView_hienthi.DataSource, "TenNgan")
        ComboBoxKe.DataBindings.Clear()
        ComboBoxKe.DataBindings.Add("Text", DataGridView_hienthi.DataSource, "TenKe")
        ComboBoxKho.DataBindings.Clear()
        ComboBoxKho.DataBindings.Add("Text", DataGridView_hienthi.DataSource, "TenKho")
        ComboBoxHuyen.DataBindings.Clear()
        ComboBoxHuyen.DataBindings.Add("Text", DataGridView_hienthi.DataSource, "T_Huyen")
        ComboBoxXa.DataBindings.Clear()
        ComboBoxXa.DataBindings.Add("Text", DataGridView_hienthi.DataSource, "TenXa")
        ComboBoxThoiHanBQ.DataBindings.Clear()
        ComboBoxThoiHanBQ.DataBindings.Add("Text", DataGridView_hienthi.DataSource, "ThoiHanBaoQuan")
        If LayIDCapDVHC() = 1 Then
            rbTinh.Checked = True
            Return
        End If
        If LayIDCapDVHC() = 2 Then
            rbHuyen.Checked = True
            Return
        End If
        If LayIDCapDVHC() = 3 Then
            rbXa.Checked = True
            Return
        End If
    End Sub
    Private Function LayIDCapDVHC()
        Dim sql As String = ""
        Dim id As Integer
        sql = "SELECT CapDVHCID FROM HOSOKIEMKE WHERE MahosoID = @mahosoid"
        cmd = New SqlCommand(sql, ob_cnn)
        cmd.Parameters.AddWithValue("mahosoid", TextBoxSoHoSo.Text)
        ob_cnn.Open()
        id = cmd.ExecuteScalar()
        ob_cnn.Close()
        Return id
    End Function

    Private Sub ComboBoxHuyen_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBoxHuyen.SelectedIndexChanged
        cmd = New SqlCommand(" select * from TenXa where mahuyen = '" & ComboBoxHuyen.SelectedValue.ToString & "' ", ob_cnn)
        dbAdapter = New SqlDataAdapter(cmd)
        tbl = New DataTable()
        dbAdapter.Fill(tbl)
        ComboBoxXa.DisplayMember = "TenXa"
        ComboBoxXa.ValueMember = "maxa"
        ComboBoxXa.DataSource = tbl
        ob_cnn.Close()
    End Sub
    Private Sub rbTinh_CheckedChanged(sender As Object, e As EventArgs) Handles rbTinh.CheckedChanged
        If rbTinh.Checked Then
            ComboBoxHuyen.Enabled = False
            ComboBoxXa.Enabled = False
        End If
    End Sub

    Private Sub rbHuyen_CheckedChanged(sender As Object, e As EventArgs) Handles rbHuyen.CheckedChanged
        If rbHuyen.Checked Then
            ComboBoxXa.Enabled = False
            ComboBoxHuyen.Enabled = True
        End If
    End Sub
    Private Sub rbXa_CheckedChanged(sender As Object, e As EventArgs) Handles rbXa.CheckedChanged
        If rbXa.Checked Then
            ComboBoxHuyen.Enabled = True
            ComboBoxXa.Enabled = True
        End If
    End Sub
    

    Private Sub ButtonThoat_Click(sender As Object, e As EventArgs) Handles ButtonThoat.Click
        Me.Close()
    End Sub

    Private Sub DataGridView_hienthi_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView_hienthi.CellClick
        If e.RowIndex = -1 Then
            Return
        End If
        NapVaoTexBox()
    End Sub

    Private Sub DataGridViewNguoiMuon_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridViewNguoiMuon.CellClick
        If e.RowIndex = -1 Then
            Return
        End If
        TextBoxNguoiYeuCau.DataBindings.Clear()
        TextBoxNguoiYeuCau.DataBindings.Add("Text", DataGridViewNguoiMuon.DataSource, "NguoiMuon")
        TextBoxDonViCT.DataBindings.Clear()
        TextBoxDonViCT.DataBindings.Add("Text", DataGridViewNguoiMuon.DataSource, "DonVi")
        TextBoxDiaChi.DataBindings.Clear()
        TextBoxDiaChi.DataBindings.Add("Text", DataGridViewNguoiMuon.DataSource, "DiaChi")
    End Sub

    Private Sub ButtonInPhieu_Click(sender As Object, e As EventArgs) Handles ButtonInPhieu.Click
        If TextBoxSoHoSo.Text = Nothing Then
            MessageBox.Show("Chọn hồ sơ cần thao tác!")
            Return
        End If
        Dim tenCapDVHC = ""
        If rbTinh.Checked Then
            tenCapDVHC = rbTinh.Text
        End If
        If rbHuyen.Checked Then
            tenCapDVHC = rbHuyen.Text & ", thuộc " & ComboBoxHuyen.Text & ""
        End If
        If rbXa.Checked Then
            tenCapDVHC = rbXa.Text & ", thuộc  " & ComboBoxXa.Text & ", " & ComboBoxHuyen.Text & ""
        End If
        Dim ts() As String = {"<SoPhieuMuon>", "<NguoiMuon>", "<DonVi>", "<DiaChi>", "<SoHoSo>", "<TenHoSo>", "<LoaiTaiLieu>", "<NamLap>", "<CapDVHC>", "<ThuocHuyen>", "<ThuocXa>", "<TenKho>", "<TenKe>", "<TenPhong>", "<MucDichMuon>", "<HinhThuc>", "<NgayMuon>", "<NguoiNhap>"}
        Dim gt() As String = {AutoID("CCTT_HOSOKIEMKE_THONGKE"), TextBoxNguoiYeuCau.Text, TextBoxDonViCT.Text, TextBoxDiaChi.Text, TextBoxSoHoSo.Text, ComboBoxHoso.Text, ComboBoxTaiLieuKK.Text, TextBoxNamLap.Text, tenCapDVHC, ComboBoxHuyen.Text.Trim, ComboBoxXa.Text.Trim, ComboBoxKho.Text.Trim, ComboBoxKe.Text.Trim, ComboBoxPhong.Text.Trim, TextBoxMucDichSuDung.Text, ComboBoxHinhThuc.Text.ToString, DateTimePicker2.Text, GetTenNguoiNhap(ModuleTenDangNhap.m_tennhap)}
        ExportWord(ts, gt, "PhieuMuonHoSoThongKeKiemKe", AutoID("CCTT_HOSOKIEMKE_THONGKE"))
    End Sub
End Class